import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import "lib-flexible/flexible.js"


createApp(App).use(store).use(router).mount('#app')
const EventBus = {  
    callbacks: {},  
    
    $emit(eventName, ...args) {  
      this.callbacks[eventName]?.forEach(callback => {  
        callback(...args);  
      });  
    },  
    
    $on(eventName, callback) {  
      if (!this.callbacks[eventName]) {  
        this.callbacks[eventName] = [];  
      }  
      this.callbacks[eventName].push(callback);  
    },  
    
    $off(eventName, callback) {  
      if (this.callbacks[eventName]) {  
        this.callbacks[eventName] = this.callbacks[eventName].filter(cb => cb !== callback);  
      }  
    },  
    
    $offAll(eventName) {  
      if (eventName) {  
        delete this.callbacks[eventName];  
      } else {  
        this.callbacks = {};  
      }  
    }  
  };  
    
  export { EventBus };